home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
v9n19.arc
/
FIELD_LE.PRG
< prev
next >
Wrap
Text File
|
1990-10-13
|
1KB
|
47 lines
* FIELD_LEN.PRG - MAX LENGTH OF CHARACTER VARIABLES - D. Chambless
SET TALK OFF
CLOSE DATABASES
SELECT 1
USE FAT_FILE
COPY STRUCTURE EXTENDED TO TEMP
SELECT 2
USE TEMP
SET FILTER TO FIELD_TYPE = 'C'
GO TOP
NO_CVAR = 0
DO WHILE .NOT. EOF()
NO_CVAR = NO_CVAR + 1
NSTR = IIF(NO_CVAR < 10, STR(NO_CVAR,1), STR(NO_CVAR,2))
NAM_CVAR&NSTR = TRIM(FIELD_NAME)
LEN_CVAR&NSTR = 0
SKIP
ENDDO VAR
TOO_MANY = NO_CVAR
SELECT 1
GO TOP
DO WHILE .NOT. EOF()
NO_CVAR = 0
DO WHILE NO_CVAR < TOO_MANY
NO_CVAR = NO_CVAR + 1
NSTR = IIF(NO_CVAR < 10, STR(NO_CVAR,1), STR(NO_CVAR,2))
FIELD = NAM_CVAR&NSTR
LEN_CVAR&NSTR = MAX(LEN_CVAR&NSTR, LEN(LTRIM(TRIM(&FIELD))))
ENDDO VAR
SKIP
ENDDO EOF
SET PRINT ON
NO_CVAR = 0
DO WHILE NO_CVAR < TOO_MANY
NO_CVAR = NO_CVAR + 1
NSTR = IIF(NO_CVAR < 10, STR(NO_CVAR,1), STR(NO_CVAR,2))
? NAM_CVAR&NSTR, STR(LEN_CVAR&NSTR,5)
ENDDO VAR
SET PRINT OFF
EJECT
CLOSE DATABASES
ERASE TEMP.DBF
RETURN